package p270jp.pxv.android.legacy.model;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import android.support.p024v4.media.C0261e;
import java.util.Date;
import p104de.greenrobot.dao.AbstractDao;
import p104de.greenrobot.dao.Property;
import p104de.greenrobot.dao.internal.DaoConfig;

/* renamed from: jp.pxv.android.legacy.model.LikedWorkDao */
/* loaded from: classes2.dex */
public class LikedWorkDao extends AbstractDao<LikedWork, Long> {
    public static final String TABLENAME = "LIKED_WORK";

    /* renamed from: jp.pxv.android.legacy.model.LikedWorkDao$Properties */
    /* loaded from: classes2.dex */
    public static class Properties {

        /* renamed from: Id */
        public static final Property f19075Id = new Property(0, Long.class, "id", true, "_id");
        public static final Property WorkId = new Property(1, Long.class, "workId", false, "WORK_ID");
        public static final Property UserId = new Property(2, Long.class, "userId", false, "USER_ID");
        public static final Property LoggedInUserId = new Property(3, Long.class, "loggedInUserId", false, "LOGGED_IN_USER_ID");
        public static final Property ContentType = new Property(4, String.class, "contentType", false, "CONTENT_TYPE");
        public static final Property CreatedAt = new Property(5, Date.class, "createdAt", false, "CREATED_AT");
    }

    public LikedWorkDao(DaoConfig daoConfig) {
        super(daoConfig);
    }

    public static void createTable(SQLiteDatabase sQLiteDatabase, boolean z) {
        String str = z ? "IF NOT EXISTS " : "";
        sQLiteDatabase.execSQL("CREATE TABLE " + str + "\"LIKED_WORK\" (\"_id\" INTEGER PRIMARY KEY ,\"WORK_ID\" INTEGER,\"USER_ID\" INTEGER,\"LOGGED_IN_USER_ID\" INTEGER,\"CONTENT_TYPE\" TEXT NOT NULL ,\"CREATED_AT\" INTEGER NOT NULL );");
    }

    public static void dropTable(SQLiteDatabase sQLiteDatabase, boolean z) {
        StringBuilder c = C0261e.m12042c("DROP TABLE ");
        c.append(z ? "IF EXISTS " : "");
        c.append("\"LIKED_WORK\"");
        sQLiteDatabase.execSQL(c.toString());
    }

    @Override // p104de.greenrobot.dao.AbstractDao
    public boolean isEntityUpdateable() {
        return true;
    }

    public LikedWorkDao(DaoConfig daoConfig, DaoSession daoSession) {
        super(daoConfig, daoSession);
    }

    public void bindValues(SQLiteStatement sQLiteStatement, LikedWork likedWork) {
        sQLiteStatement.clearBindings();
        Long id = likedWork.getId();
        if (id != null) {
            sQLiteStatement.bindLong(1, id.longValue());
        }
        Long workId = likedWork.getWorkId();
        if (workId != null) {
            sQLiteStatement.bindLong(2, workId.longValue());
        }
        Long userId = likedWork.getUserId();
        if (userId != null) {
            sQLiteStatement.bindLong(3, userId.longValue());
        }
        Long loggedInUserId = likedWork.getLoggedInUserId();
        if (loggedInUserId != null) {
            sQLiteStatement.bindLong(4, loggedInUserId.longValue());
        }
        sQLiteStatement.bindString(5, likedWork.getContentType());
        sQLiteStatement.bindLong(6, likedWork.getCreatedAt().getTime());
    }

    public Long getKey(LikedWork likedWork) {
        if (likedWork != null) {
            return likedWork.getId();
        }
        return null;
    }

    /* JADX WARN: Can't rename method to resolve collision */
    @Override // p104de.greenrobot.dao.AbstractDao
    public Long readKey(Cursor cursor, int i) {
        int i2 = i + 0;
        if (cursor.isNull(i2)) {
            return null;
        }
        return Long.valueOf(cursor.getLong(i2));
    }

    public Long updateKeyAfterInsert(LikedWork likedWork, long j) {
        likedWork.setId(Long.valueOf(j));
        return Long.valueOf(j);
    }

    @Override // p104de.greenrobot.dao.AbstractDao
    public LikedWork readEntity(Cursor cursor, int i) {
        int i2 = i + 0;
        Long valueOf = cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2));
        int i3 = i + 1;
        Long valueOf2 = cursor.isNull(i3) ? null : Long.valueOf(cursor.getLong(i3));
        int i4 = i + 2;
        Long valueOf3 = cursor.isNull(i4) ? null : Long.valueOf(cursor.getLong(i4));
        int i5 = i + 3;
        return new LikedWork(valueOf, valueOf2, valueOf3, cursor.isNull(i5) ? null : Long.valueOf(cursor.getLong(i5)), cursor.getString(i + 4), new Date(cursor.getLong(i + 5)));
    }

    public void readEntity(Cursor cursor, LikedWork likedWork, int i) {
        int i2 = i + 0;
        Long l = null;
        likedWork.setId(cursor.isNull(i2) ? null : Long.valueOf(cursor.getLong(i2)));
        int i3 = i + 1;
        likedWork.setWorkId(cursor.isNull(i3) ? null : Long.valueOf(cursor.getLong(i3)));
        int i4 = i + 2;
        likedWork.setUserId(cursor.isNull(i4) ? null : Long.valueOf(cursor.getLong(i4)));
        int i5 = i + 3;
        if (!cursor.isNull(i5)) {
            l = Long.valueOf(cursor.getLong(i5));
        }
        likedWork.setLoggedInUserId(l);
        likedWork.setContentType(cursor.getString(i + 4));
        likedWork.setCreatedAt(new Date(cursor.getLong(i + 5)));
    }
}
